summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/(system)/email-whitelist/page.tsx
blob: 95abd556d5781b80673078b41bbfb3fe431261b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * 이메일 화이트리스트
 *
 * 이메일 도메인의 화이트리스트를 통해, SMS 인증을 우회할 도메인을 관리
 *
 * db schema : db/schema/emailWhitelist.ts
 *
 * 구현방향: 이메일 화이트리스트 조회 + dialog 기반의 생성/삭제
 *
 */

import * as React from "react"
import { type Metadata } from "next"
import { getEmailWhitelistList } from "@/lib/email-whitelist/service"
import { type SearchParams } from "@/types/table"
import { WhitelistTable } from "@/lib/email-whitelist/table/whitelist-table"
import { Shell } from "@/components/shell"
import { Skeleton } from "@/components/ui/skeleton"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"

// export const metadata: Metadata = {
//   title: "이메일 화이트리스트 관리",
//   description: "SMS 인증 대신 이메일로 인증번호를 받을 도메인 및 개별 이메일을 관리",
// }

interface WhitelistPageProps {
  searchParams: SearchParams
}

export default async function WhitelistPage(props: WhitelistPageProps) {

  const searchParams = await props.searchParams

  // 기본 검색 파라미터 처리
  const search = {
    page: searchParams.page ? parseInt(searchParams.page as string) : 1,
    perPage: searchParams.perPage ? parseInt(searchParams.perPage as string) : 10,
    search: searchParams.search as string || "",
    sort: searchParams.sort as string || "createdAt.desc",
    filters: searchParams.filters ? JSON.parse(searchParams.filters as string) : undefined,
  }

  const promises = Promise.all([
    getEmailWhitelistList(search),
  ])

  return (

    <Shell className="gap-2">
      <div className="flex items-center justify-between space-y-2">
        <div className="flex items-center justify-between space-y-2">
          <div>
            <div className="flex items-center gap-2">
              <h2 className="text-2xl font-bold tracking-tight">
                이메일 화이트리스트 관리
              </h2>
            </div>
            <p className="text-muted-foreground">
              SMS 인증 대신 이메일로 인증번호를 받을 도메인 및 개별 이메일을 관리합니다.
            </p>
          </div>
        </div>
      </div>

      <React.Suspense fallback={<Skeleton className="h-7 w-52" />}>
      </React.Suspense>
      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={5}
            searchableColumnCount={1}
            filterableColumnCount={2}
            cellWidths={["4rem", "12rem", "20rem", "12rem", "12rem", "8rem"]}
            shrinkZero
          />
        }
      >
        <WhitelistTable promises={promises} />
      </React.Suspense>
    </Shell>
  )
}